home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / oper_sys / deltablu / list.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-08-17  |  948 b   |  35 lines

  1. /***************************************************************************
  2.  List.h
  3.  
  4.     Supports variable sized, ordered lists of elements.
  5.  
  6. ****************************************************************************/
  7.  
  8. typedef enum {false, true} Boolean;
  9. typedef    void (*Proc)();
  10. typedef    void * Element;
  11.  
  12. typedef struct {
  13.     Element    *slots;        /* variable-sized array of element slots */
  14.     int        slotCount;    /* number of slots currently allocated */
  15.     int        first;        /* index of first element */
  16.     int        last;        /* index of last element (first-1, if empty) */
  17. } *List, ListStruct;
  18.  
  19. /* Creation and Destruction */
  20.   List        List_Create(int);
  21.   void        List_Destroy(List);
  22.  
  23. /* Enumeration and Queries */
  24.   void        List_Do(List, Proc);
  25.   int        List_Size(List);
  26.  
  27. /* Adding */
  28.   void        List_Add(List, Element);
  29.   void        List_Append(List, List);
  30.  
  31. /* Removing */
  32.   void        List_Remove(List, Element);
  33.   void        List_RemoveAll(List);
  34.   Element    List_RemoveFirst(List);
  35.